<template>
	<view class="my-content-info">
		<view class="list">
			<view class="li" v-for="(item,index) in list" :key="index" @click="jumpPage(item)"><view class="li-left">{{item.description}}</view><view class="li-right">{{statusText(item.status)}}<u-icon name="arrow-right" color="#E1E0E0" size="28"></u-icon></view></view>
		</view>
	</view>
</template>

<script>
	import {
		getStoreData,
		dealNum,
		setStoreData,
		httpPost,
		httpGet,
	} from "@/utils/http.js";
	const pic1 = require(`@/img/my/my1.png`);
	const avatar = require(`@/img/my/avatar1.jpg`);
	export default {
		data() {
			return {
                  list:[]
			};
		},
		onLoad() {
			this.userInfo = getStoreData("userInfo");
			

		},
		onShow() {
			this.getList();
		},
		methods: {
			getList() {
				let that = this;
				httpPost("/api/sellerstoreagreement/agreementList", {
						contractTypes: [],
						statuss: []
					})
					.then((res) => {
                        that.list=res.data||[];
					})
					.catch((e) => {});
			},
			statusText(val){
				let text="";
				if(val==1){
					text="申请中，请去实名认证"
				}
				if(val==2){
					text="实名认证已完成，去签约"
				}
				if(val==3){
					text="签署中"
				}
				if(val==4){
					text="签署完成"
				}
				if(val==5){
					text="实名认证失败，去修改"
				}
				
				return text
			},
			jumpPage(data){
				let that=this;
				if(data.status==1){
					httpGet(`/api/sellerstoreagreement/realApprove/${data.contractType}/${data.id}`).then((res) => {
					   that.getList();
					});
				}
				if(data.status==2){
					uni.navigateTo({
						url: '/pages/contractManage/thirdParty?urlAddress='+data.agreementAddress
					});
				}
				if(data.status==3){
					uni.showToast({
						icon: "none",
						title: "合同正在签署中"
					});
					return;
				}
				if(data.status==4){
					uni.showToast({
						icon: "none",
						title: "合同已签署完成"
					});
					return;
				}
				if(data.status==5){
					uni.navigateTo({
						url: '/pages/contractManage/modifyAuthInfo?infoStr='+JSON.stringify(data)
					});
				}
			}


		},
	};
</script>

<style lang="scss">
	.my-content-info {
		background-color: #F7F7F7;
		height: calc(100vh - 44px);
		padding-top: 20rpx;
	}

	.list {
		margin-left: 30rpx;
		margin-right: 30rpx;
		background-color: #fff;
		padding-left: 30rpx;
		padding-right: 30rpx;
		border-radius: 10rpx;

		.li {
			padding-top: 30rpx;
			padding-bottom: 30rpx;
			border-bottom: 2rpx solid #F7F7F7;
			display: flex;
			justify-content: space-between;
			flex-direction: row;
		}
	}
</style>